﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FigureDraw
{
    public class Diagram
    {
        private List<CommonShape> listShape;
        //private DiagramFactory factory;

        public Diagram()
        {
            this.listShape = new List<CommonShape>();
        }

        public void AddShape(CommonShape shape)
        {
            this.listShape.Add(shape);
        }

        public void ConvertTo(DiagramFactory factory)
        {
            //Diagram result = new Diagram();
            for (int i = 0; i < listShape.Count; i++)
            {
                Infor infor = listShape[i].GetInfor();
                listShape[i].Clear();
                listShape[i] = listShape[i].Clone(factory, infor);
            }
            //this.factory = factory;
            //return result;
        }

        public void DrawToDevice(Form form)
        {
            for (int i = 0; i < this.listShape.Count; i++)
            {
                this.listShape[i].DrawToDevice(form);
            }
        }

        public List<CommonShape> GetListShape()
        {
            return this.listShape;
        }
    }
}
